import request from './index'

export const doCodeLogin = (data: any, page?: string) => {
  return request.ajax({
    data: data,
    url: '/Account/Code/Login',
    type: 'POST',
    page: page,
    noLogin: true
  })
}

export const doLogOff = (page?: string) => {
  return request.ajax({
    url: '/Account/User/LogoutUser',
    type: 'POST',
    page: page,
    noLogin: true
  })
}

export const doUserInfo = () => {
  return request.ajax({
    url: '/Account/User',
    type: 'GET',
    page: '/app'
  })
}

export const doUpdInfo = (data: any, page?: string) => {
  return request.ajax({
    url: '/Account/User',
    type: 'POST',
    page: page,
    data
  })
}

export const doUploadImage = (filePath?: string) => {
  return request.upload({
    filePath,
    name: "file",
    fileType: "image",
    url: '/Account/User/Upload',
  })
}

export const doRegister = (data: any, page?: string) => {
  return request.ajax({
    data: data,
    url: '/Account/Register/WeChatCodePhone',
    type: 'POST',
    whiteList: true,
    page: page
  })
}

export const doSignOut = () => {
  return request.signOut()
}